package com.shopx.auth.service;

import com.shopx.base.exception.ShopxException;

/**
 * @author lituo
 * @className: ISysLoginTokenService
 * @description: 令牌
 * @date 2021/12/5 10:42 AM
 */
public interface ISysLoginTokenService {

  /**
   * 从redis获取令牌
   *
   * @return com.shopx.auth.bean.SysLoginToken
   * @author lituo
   * @date 3:13 PM 2021/12/5
   * @param  userId
   * @param  userType
   */
  String selectByRedis(String userId, String userType) throws ShopxException;

  /**
   * 客户登录后，判断是否存在令牌。没有新增，有则修改。同时更新缓存中令牌信息
   *
   * @return void
   * @author lituo
   * @date 3:13 PM 2021/12/5
   * @param  tokenId
   * @param  userType
   * @param  userId
   */
  void setUserTokensForRedis(String tokenId, String userType, String userId) throws ShopxException;

  /**
   * 验证用户是否登录
   *
   * @return boolean
   * @author lituo
   * @date 3:13 PM 2021/12/5
   * @param  userId
   * @param  userType
   * @param  tokenId
   */
  boolean checkUserLogin(String userId, String userType, String tokenId) throws ShopxException;

}

